package com.beerandjesus.webapp.sportofkings.handicapper.struts.action;

import com.opensymphony.xwork2.validator.annotations.RegexFieldValidator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Date: Jun 1, 2012
 * Time: 1:57:03 PM
 */
@Component
public class AnalyzeLocalFileAction extends BaseAnalyzeAction {

    private String fileName;
    @Value("${com.beerandjesus.sportofkings.handicapper.local-file-path}")
    private String localFilePath;

    public String execute() throws Exception {
        return execute(localFilePath + fileName);
    }


    @RegexFieldValidator(message = "Please provide a file name", expression = "^[A-Z]{2,3}[0-9]{4,8}.[A-Z]{2,3}$")
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileName() {
        return fileName;
    }


    public void setLocalFilePath(String localFilePath) {
        this.localFilePath = localFilePath;
    }
}
